import { ApiCall } from "tsrpc";
import { ReqMarkAsRead, ResMarkAsRead } from "../../../shared/protocols/masterServer/mail/PtlMarkAsRead";
import { DBMail } from "../../DBMail";
import { MasterServerConn } from "../../MasterServer";

export async function ApiMarkAsRead(call: ApiCall<ReqMarkAsRead, ResMarkAsRead>) {
    let req = call.req;
    let info = (call.conn as MasterServerConn).userInfo;
    let mails = DBMail.markAsRead(req.mailId);
    call.succ({ mails: mails });
}